#!/usr/bin/env python3
import socket
import sys
import errno
from socket import error as socket_error
def Main():
    if(len(sys.argv) != 3):
        print('Incorrect syntax, correct syntax is ' + sys.argv[0] + ' host port')
        sys.exit(1)
    host = sys.argv[1]
    port = sys.argv[2]
    clientSocket=socket.socket()
    try:
        clientSocket.connect((host,int(port)))
    except socket_error as serr:
        print('Could not connect to server, check host and port.')
        sys.exit(1)
    data=clientSocket.recv(1025).decode()
    print(data)
    print("Closing now...")
    clientSocket.close()
if __name__ == '__main__':
    Main()
